import os
from selenium import webdriver
files_path = os.path.abspath("./files/")
driver = webdriver.Chrome()
upload_page = 'file:///' + 'file_path'+'upfile.html'
driver.get(upload_page)
#定位上传按钮，添加本地文件
driver.find_element_by_id("file").send_keys(files_path +'test.txt')